package com.suncp.job;

import org.quartz.Job;
import org.quartz.JobExecutionContext;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * Notice: 打印任意内容定时任务
 *
 * @author scp
 * @version 1.0
 * @date 2021/3/10
 * @since 1.0
 */
public class PrintWordsJob implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        System.out.println(jobExecutionContext.getJobDetail().getJobDataMap().get("jobDetail1"));
        System.out.println(jobExecutionContext.getTrigger().getJobDataMap().get("trigger1"));
        String printTime = new SimpleDateFormat("yy-MM-dd HH-mm-ss").format(new Date());
        System.out.println("PrintWordJob start at:" + printTime + " , prints: Hello Job-" + new Random().nextInt(100));
    }
}
